package sd.rmi.auction.server;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import sd.rmi.auction.interfaces.IAuction;

/**
 * 
 * @author v
 *
 */
public class Auctioneer extends UnicastRemoteObject implements IAuction {
	private int bid = -1;
	private String product;
	
	
	/**
	 * 
	 * @param name
	 * @param price
	 * @throws RemoteException
	 */
	protected Auctioneer(String name, int price) throws RemoteException {
		super();
		this.product = name;
		this.bid = price;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	
	
	@Override
	public int getCurrentBid() throws RemoteException {
		return bid;
	}

	@Override
	public String getProduct() throws RemoteException {
		return product;
	}

	@Override
	public void setBid(int bid) throws RemoteException {
		this.bid = this.bid < bid ? bid : this.bid;
	}
	
}